import logging
import sys
import time
formatter=logging.Formatter('%(asctime)s %(message)s','%d-%m %H:%M:%S')
#-----------------------------------------------------------------
console_handler=logging.StreamHandler(sys.stderr) 
console_handler.setLevel(logging.DEBUG)
console_handler.setFormatter(formatter) 
#-----------------------------------------------------------------
"""
def current_time_log():
    if time.ctime().split(' ')[2] == '':
        name_file=('C:\Python32\logrus\Bishop\logs\Log_%s_%s_%s.log' %
                   (time.ctime().split(' ')[3],
                    time.ctime().split(' ')[1],
                    time.ctime().split(' ')[5]))
    else:
        name_file=('C:\Python32\logrus\Bishop\logs\Log_%s_%s_%s.log' %
                   (time.ctime().split(' ')[2],
                    time.ctime().split(' ')[1],
                    time.ctime().split(' ')[4]))
    return name_file
"""

file_handler=logging.FileHandler('C:\Python32\logrus\Bishop\logs\Bishop.log', 'a')
file_handler.setFormatter(formatter)
#------------------------------------------------------------------
log=logging.getLogger('bishop')
log.setLevel(logging.DEBUG)
log.addHandler(console_handler)
log.addHandler(file_handler)